<?php
//print_r($_GET);die;//Array ( [ids] => 125,124, )
include_once("./function.php");
extract($_GET);//$ids
$ids=rtrim($ids,",");
//echo $ids;die;//125,124
$one=explode(",",$ids);
//print_r($one);die//;Array ( [0] => 125 [1] => 124 )
function getValue($arr)
{
 foreach($arr as $key => $value)
 {
  if(is_array($value)){
   getValue($value);
 }
 else
 {
   $value."<br>";
 }
 }
}
//getValue($one);
//print_r($one[1]);die;

for($i=0;$i<count($one);$i++)
{
	$sql="select * from ts_product where pid=$one[$i]";
	//echo $sql;die;
	$res=mysqli_query($link,$sql);
	if(is_object($res))
	{
		if(mysqli_num_rows($res)==1)
		{
			$list=mysqli_fetch_assoc($res);	
		}
	}
	if($list['thumb']!='')
	{
		unlink($list['thumb']);
	}
	if($list['pimgs']!='')
	{
		$more=explode(",",$list['pimgs']);
		foreach($more as $v)
		{
			unlink($v);
		}
	}
	$sql="delete from ts_product where pid=$one[$i]";
	$res=mysqli_query($link,$sql);
	if($res)
	{
		if(mysqli_affected_rows($link)==1)
		{
			msg("删除成功","product.php");
		}
		else
		{
			msg("删除失败","product.php");exit;
		}
	}

}
?>